<?php

require_once("classes/db_functions.php");

$db = new db_functions();

$res_ugoul = $db->select2("SELECT id, datum_ulaza FROM ugovori_ulaz WHERE materijal=1 ORDER BY id");
$ok=true;

foreach ($res_ugoul as $row){
	$id = $row["id"];
	$datum = $row["datum_ulaza"];
	$q = "INSERT INTO ugovori_ulaz_materijal VALUES("
		."$id,$datum,'ulaz',1,5,'192.168.5.7','import sa ulaza'"
		."); ";
	if($db->alterTable($q)){
		$ok = true;
	}else{
		$ok = false;
	}
}
if($ok){
	echo "<br />uvoz izvršen.<br />".mysql_stat();
}else{
	echo "uvoz neuspeo!<br />".mysql_error();
}
?>